import YcRequest from '@/service'
import { resultDataType } from '../../types'
import { systemDataType } from './types'
export function getPageListData(url: string, queryInfo: any) {
  return YcRequest.post<resultDataType<systemDataType>>({
    url,
    data: queryInfo
  })
}

// url:/user/id
export function deletePageData(url: string) {
  // resultDataType 是描述返回数据的公共类型 <后面的泛型>是data里面的数据类型
  return YcRequest.delete<resultDataType>({
    url
  })
}

export function createPageData(url: string, newData: any) {
  return YcRequest.post<resultDataType>({
    url,
    data: newData
  })
}

export function editPageData(url: string, editData: any) {
  return YcRequest.patch<resultDataType>({
    url,
    data: editData
  })
}
